#PM2.5 leaflets
PM25_1990_leaflet
PM25_2017_leaflet
pdeath_1990_leaflet
pdeath_2017_leaflet
DALY_1990_leaflet
DALY_2017_leaflet
DALY_change_leaflet
#trying out sth different--kinda don't know what to make out of the choropleths
# library(ggplot2)
# library(gganimate)
# library(gifski)
# 
# 
# tempdata <- data_healthimp_wide[, c(1, 2, 3, 4, 5)]
# tempdata <- tempdata%>%
#   pivot_wider(values_from = `ambientpm2.5.dalyper1k`,
#               names_from = sex, 
#               names_glue = "{sex}")
# tempdata$DALY <- tempdata$`F` + tempdata$M
# 
# tempdata <- tempdata%>%
#   select(-c(`F`, M))
# tempdata <- tempdata[tempdata$year == 1990 | tempdata$year == 1995 | tempdata$year == 2000| tempdata$year == 2005| tempdata$year == 2010| tempdata$year == 2011| tempdata$year == 2012| tempdata$year == 2013| tempdata$year == 2014| tempdata$year == 2015| tempdata$year == 2016| tempdata$year == 2017, ]
# 
# path_bella <- "C:/Users/Bella/Desktop/git/Blog-HealthAndJusticeLeague/data"
# data_PM25 <- read_csv(paste0(path_bella,
#                              "/Exposure_PM25_air.csv"))
# 
# #taking out unnecessary column varaibles
# data_PM25 <- data_PM25%>%
#   select(COU, Country, Variable, Year, Value)%>%
#   rename(country = Country,
#          year = Year)
# 
# #separate out the variables
# data_PM25_wide <- data_PM25%>%
#   pivot_wider(values_from = Value,
#               names_from = Variable,
#               names_glue = "{Variable}")
# tempdata2 <- left_join(tempdata, data_PM25_wide, by = c("country", "year"), copy = TRUE)%>%
#   select(-c(COU, cou))
# 
# g <- ggplot(tempdata2, aes(`Mean population exposure to PM2.5`, DALY, color = country))+
#   geom_point(alpha = 0.7, show.legend = FALSE)+
#   scale_size(range = c(2, 12))+
#   labs(title = 'Year: {frame_time}', x = 'PM 2.5', y = 'DALY per 1K')+
#   transition_time(year)+
#   ease_aes('linear')

#animate(g, duration = 10, fps = 20, width = 200, height = 200, renderer = gifski_renderer())
#anim_save("tempdata2.gif")